import { INotificationHelper } from '@/core';
import { showNotify } from 'vant';
import 'vant/es/notify/style';
export class NotificationHelper implements INotificationHelper {
	/**
	 * @description 单例变量声明
	 * @protected
	 * @static
	 * @type {NotificationHelper}
	 * @memberof AppFuncHelper
	 */
	protected static service: INotificationHelper;

	/**
	 * @description 获取实例
	 * @static
	 * @return {*}  {INotificationHelper}
	 * @memberof NotificationHelper
	 */
	static getInstance(): INotificationHelper {
		if (!this.service) {
			this.service = new NotificationHelper();
		}
		return this.service;
	}

	/**
	 * @description 成功提示
	 * @param {string} title 标题
	 * @param {string} message 内容
	 * @memberof NotificationHelper
	 */
	success(message: string): void {
		showNotify({ type: 'success', message: message });
	}

	/**
	 * @description 信息提示
	 * @param {string} title 标题
	 * @param {string} message 内容
	 * @memberof NotificationHelper
	 */
	info(message: string): void {
		showNotify({ type: 'primary', message: message });
	}

	/**
	 * @description 警告提示
	 * @param {string} title 标题
	 * @param {string} message 内容
	 * @memberof NotificationHelper
	 */
	warning(message: string): void {
		showNotify({ type: 'warning', message: message });
	}

	/**
	 * @description 错误提示
	 * @param {string} title 标题
	 * @param {string} message 内容
	 * @memberof NotificationHelper
	 */
	error(message: string): void {
		showNotify({ type: 'danger', message: message });
	}
}
